package xginxgodb

import (
	"gitee.com/xiaoyutab/xgotool/optional/xlog"
	"gitee.com/xiaoyutab/xgotool/xgin"
	"gitee.com/xiaoyutab/xgotool/xgodb/xgodbconfig"
	"github.com/gin-gonic/gin"
)

// 获取配置项列表信息
//
//	GET	get.configure
func getConfigure(c *gin.Context) *xgin.Response {
	type temp_struct struct {
		Keys string `json:"keys" form:"keys"` // 上级ID
	}
	temp := temp_struct{}
	if err := xgin.Bind(c, &temp); err != nil {
		return xgin.Resp().Error(err)
	}
	ls, err := xgodbconfig.List(temp.Keys)
	if err != nil {
		return xgin.Resp().Error(xlog.AE("数据库配置项列表获取错误", err))
	}
	return xgin.Resp().NoPage(c, ls, len(ls))
}
